<!DOCTYPE html>
<html>

<head>
    <style type="text/css">
        Canvas {
            background-color: silver;
        }
    </style>
    <script type="text/javascript">
        function drawpoint(xx, yy) {
            var mycanvas = document.getElementById("mycanvas");
            var content = mycanvas.getContext('2d');
            content.beginPath();
            content.moveTo(xx, yy);
            content.lineTo(xx + 1, yy + 1);
            content.stroke();
            content.closePath();
        }

        function btnok() {
            for (var i = 0; i < 400; i += 1) {
                drawpoint(i, i);
            }
        }
    </script>
</head>

<body>
    <canvas id="mycanvas" width="400" height="400"></canvas>
    <input type="button" value="ok" onclick="btnok()">
    <button value="yes" onclick="btnok()">yes</button>
</body>

</html>